<?php
header("Content-Type: text/html; charset=utf-8",true);
include_once("../models/cls.edicao.php");

$oEdicao = new edicao();
$oEdicao->load( $_POST );

if( empty( $_POST["id"] ) )
{
	$add = $oEdicao->insert();
	if($add == 1)
	{
		?>
		<script>
			alert("REGISTRO ADICIONADO!");
			window.location.href="../views/frm.edicao.lista.php";
		</script>
		<?php
	}
}
else{
	$add = $oEdicao->update( $_POST["id"] );
	if($add == 1)
	{
		?>
		<script>
			alert("REGISTRO ALTERADO!");
			window.location.href="../views/frm.edicao.lista.php";
		</script>
		<?php
	}
}
?>